package xy.pubsub.conf;

import org.springframework.cglib.core.Constants;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

@Component
public class MsgListener implements MessageListener {

    @Override
    public void onMessage(Message message, byte[] bytes) {
        System.out.println("主题：" + message.getChannel().toString());
        System.out.println("接收消息：" + new String(message.getBody(), StandardCharsets.UTF_8));
    }
}
